<?php foreach($this->product->getColorApplications() AS $ca): ?>
	<?php $colors = $ca->getColors() ?>
	<?php $elementId = sprintf('imageid-%s-%s-%s', $this->product->getId(), $this->product->getImageId(), $ca->getId()); ?>
	<?php if($colors->count() == 2): ?>
	<a id="<?php echo $elementId ?>" href="<?php echo $this->requestUri() ?>">
		<span class="swatch two-colors">
			<span class="inner-border">
				<?php foreach($colors AS $i=>$color): ?>
					<span class="color<?php echo ($i+1) ?>" style="background-color: #<?php echo $color->getRgbHex() ?>">&nbsp;</span>
				<?php endforeach; ?>
			</span>
		</span>
	</a>
	<?php elseif($colors->count() == 1): ?>
	<a id="<?php echo $elementId ?>" href="<?php echo $this->requestUri() ?>">
		<span class="swatch one-color">
			<span class="inner-border" style="background-color: #<?php echo $colors->current()->getRgbHex() ?>">&nbsp;</span>
		</span>
	</a>
	<?php endif; ?>
<?php endforeach; ?>
